/*
 * @Author: your name
 * @Date: 2021-01-03 21:58:53
 * @LastEditTime: 2021-01-03 22:02:15
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: \H5 2010 studyd:\H5 2010 练习\第三阶段 Vue + node\DAY 7\panda\src\api\user.js
 */
export const login = (username, password) => {
  // 模拟用户登录处理数据
  return new Promise((resolve, reject) => {
    setTimeout(() => {
      if (username === 'test' && password === '123456') {
        resolve({
          userInfo: {
            nickName: '小明',
            avatarUrl: 'http://xxx.com/1.png'
          },
          token: 'sdaddsadasasdffa'
        })
      } else {
        reject(new Error('用户名或密码错误'))
      }
    }, 2000)
  })
}
